package club.haomoon.front.controller;

import club.haomoon.core.common.AjaxResult;
import club.haomoon.core.common.PageResult;
import club.haomoon.front.config.CmsFrontThreadLocal;
import club.haomoon.front.data.user.UserAccountListData;
import club.haomoon.front.service.IUserAccountLogService;
import club.haomoon.front.validate.common.PageValidate;
import club.haomoon.front.validate.users.UserAccountLogSearchValidate;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import jakarta.annotation.Resource;

@RestController
@RequestMapping("/api/account_log")
@Tag(name = "用户资金变更管理")
public class AccountLogController {

    @Resource
    IUserAccountLogService iUserAccountLogService;

    @GetMapping("/lists")
    @Operation(summary = "用户资金变更列表")
    public AjaxResult<PageResult<UserAccountListData>> lists(@Validated PageValidate pageValidate,
                                                             @Validated UserAccountLogSearchValidate searchValidate) {
        searchValidate.setUserId(CmsFrontThreadLocal.getUserId());
        PageResult<UserAccountListData> list = iUserAccountLogService.lists(pageValidate, searchValidate);
        return AjaxResult.success(list);
    }
}
